package com.zoe.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.Random;
import java.util.UUID;

/**
 * @Author Zoe
 * @Date: 2020/11/25
 * @Description
 */
@Repository
public class UserDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public int insert() {
        String sql = "insert into user (name,address)values(?,?)";

        String substring = UUID.randomUUID().toString().substring(0, 5);

        int update = jdbcTemplate.update(sql, substring, new Random().nextInt(10));

        return update;
    }
}
